#ifndef F_CAEmuBoardPlannerC_h
#define F_CAEmuBoardPlannerC_h

// ***********************************************************************

// class EDROOMTopContext

// ***********************************************************************



class EDROOMTopContext {

protected:

enum EDROOMCAEmuBoardPlannerSignal { EDROOMSignalTimeout, EDROOMSignalDestroy, SKeepOnComm, SToStandBy, STMToTransmit, SToComm, SInStandBy, STMTransmited, SCommConfigured, STCReceived, SCommInterrupted, SToListening };


	friend class CAEmuBoardPlanner;

	CAEmuBoardPlanner &EDROOMcomponent;

	CEDROOMMessage * &Msg;

	CEDROOMMessage * &MsgBack;

	//Ports

	CEDROOMInterface & EmuPlannerSGIControl;
	CEDROOMInterface & SSICtrl;
	CEDROOMTimingInterface & CommuteTimer;

	enum edroomStateId{I, SSICommunication, SGICommunication};

	enum IdTrans{Init, CommToSGI, CommToSSI, CommInterrupted, TMTxCompleted,  EDROOMMEMORIA };

	//Constantes



	//Variables

	bool_t &VSGIStandby;
	bool_t &VTimerActive;


	//Pool

	class CEDROOMPOOLCDCommConfig:public CEDROOMProtectedMemoryPool {
		public:
		CEDROOMPOOLCDCommConfig(TEDROOMUInt32 elemCount,CDCommConfig *pMem, TEDROOMBool *pMarks);
		CDCommConfig	* AllocData();
	};
	CEDROOMPOOLCDCommConfig	& EDROOMPoolCDCommConfig;


	// CONSTRUCTORES

	EDROOMTopContext (CAEmuBoardPlanner &act, bool_t & EDROOMpVarVSGIStandby, bool_t & EDROOMpVarVTimerActive, CEDROOMPOOLCDCommConfig & EDROOMpPoolCDCommConfig );

	EDROOMTopContext ( EDROOMTopContext &contex );

public:

	bool EDROOMSearchContextTrans(TEDROOMTransId &edroomCurrentTrans);

	void EDROOMNuevoMens () { EDROOMcomponent.EDROOMNewMsg(); }

	// Funciones Definidas por el usuario

	void	FCommInterrupted();

	void	FInit();

	void	FSGICommunication();

	void	FSSICommunication();

	void	FTMCompleted();

	void	FToSGIComm();

	void	FToSSIComm();

};

// ***********************************************************************

// class EDROOMTopState

// ***********************************************************************



class EDROOMTopState : public EDROOMTopContext {

protected:



	EDROOMTopContext::edroomStateId edroomCurrentState;

	EDROOMTopContext::edroomStateId edroomNextState;

	//Variables

	bool_t VSGIStandby;
	bool_t VTimerActive;


	//Pools

	CEDROOMPOOLCDCommConfig	EDROOMPoolCDCommConfig;


public:

	// CONSTRUCTOR

	EDROOMTopState (CAEmuBoardPlanner &act, CEDROOMMemory *pEDROOMMemory  );


	// EDROOMBehaviour**********************************************

	void EDROOMBehaviour();

	// Inicio**********************************************

	void EDROOMInicio();

	// ***********************************************************************

	// SubEstado Inicial 

	// ***********************************************************************



	TEDROOMTransId EDROOMIllegada();

	// ***********************************************************************

	// SubEstado Hoja SSICommunication

	// ***********************************************************************



	TEDROOMTransId EDROOMSSICommunicationllegada();

	// ***********************************************************************

	// SubEstado Hoja SGICommunication

	// ***********************************************************************



	TEDROOMTransId EDROOMSGICommunicationllegada();

};


#endif
